package bizlogic;

import java.util.ArrayList;

import model.CompensationLeaveDTO;
import dao.CompensationLeaveDAO;
import exception.DAOSystemException;
import dao.DAOFactory;

public class CompensationLeaveManager {
	private CompensationLeaveDAO compensationLeaveDAO;
	public CompensationLeaveManager() {
		compensationLeaveDAO = DAOFactory.loadInstance().getCompensationLeaveDAO();
	}
	
	@SuppressWarnings("finally")
	public CompensationLeaveDTO findCompensationLeave(String id){
		CompensationLeaveDTO currentCompensationLeave = new CompensationLeaveDTO();
		try {
			currentCompensationLeave = compensationLeaveDAO.find(id);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} finally
		{
			return currentCompensationLeave;
		}
		
	}
    @SuppressWarnings("finally")
	public ArrayList<CompensationLeaveDTO> findAllCompensationLeave() {
    	ArrayList<CompensationLeaveDTO> currentList = new ArrayList<CompensationLeaveDTO>();
		try {
			currentList = compensationLeaveDAO.findAllCompensationLeaves();
		} catch (DAOSystemException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} finally
		{
			return currentList;
		}
    }
    public void insertCompensationLeave(CompensationLeaveDTO compensationLeave) throws DAOSystemException {

    		compensationLeaveDAO.insertCompensationLeave(compensationLeave);

    }
    public void updateCompensationLeave(CompensationLeaveDTO compensationLeave) {
    	try {
    		compensationLeaveDAO.updateCompensationLeave(compensationLeave);
		} catch (DAOSystemException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    }
    public void deleteCompensationLeave(CompensationLeaveDTO compensationLeave) {
    	try {
    		compensationLeaveDAO.deleteCompensationLeave(compensationLeave);
		} catch (DAOSystemException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    }
    
    /* Start: Added By : Suganthi V Subramaniam*/
    public void updateCompensationLeaveOT(CompensationLeaveDTO compensationLeave) throws DAOSystemException {

    		compensationLeaveDAO.updateCompensationLeaveOT(compensationLeave);

    }
    /* End: Added By : Suganthi V Subramaniam*/
}
